package com.reading_recognition_system.mapper;

import com.reading_recognition_system.pojo.History;
import org.apache.ibatis.annotations.*;

import java.util.Date;

@Mapper
public interface HistoryMapper {
    /**
     * @param 用户ID
     * @return History对象
     * */
    @Select("select * from history where u_id=#{u_id}")
    public History findHistory(@Param("u_id") int u_id);
    @Insert("insert into history(u_id,timestamp,record) values(#{uId},#{timestamp},#{record})")
    public Integer insertHistory(History history);
    @Delete("delete from history where u_id=#{u_id}")
    public Integer deleteAllHistory(@Param("u_id") int u_id);
    @Delete("delete from history where h_id=#{h_id} and u_id=#{u_id}")
    public Integer deleteOneHistory(@Param("h_id") int h_id, @Param("u_id") int u_id);
    @Delete("delete from history where timestamp=#{timestamp}")
    public Integer deleteTimeHistory(@Param("timestamp") Date timestamp);

}
